<?php
/**
 * 
 * 2013-10-14 UTF-8
 * @author Rex Lee
 *
 */
class UserAction extends Action {
	public $username=NULL;
	function _initialize() {
		import('@.Rex.autoLogin');
		$this->username=autoLogin::PC();
		$this->assign('us',$this->username);
	}

	function logout() {
		cookie(C('SID_COOKIE_NAME'), null);
		session_destroy();
		header("Location:".C('WWW_PATH'));
	}
	
	function validate() {
		$username=$_POST['username'];
		$password=$_POST['password'];

		import('@.Rex.Validatebbs');
		$rst=Validatebbs::check($username, $password);
		if ($rst) {
			echo '密码正确';
			header("Location:".C('WWW_PATH'));//登录成功，重定向跳转到主页
		}else{
			echo '登录失败';
		}
	}
}
